<?php

declare(strict_types=1);

namespace app\validate\order;

use think\Validate;

class ShipmentValidate extends Validate
{
    protected $rule = [
        'id' => 'integer|gt:0',
        'order_id' => 'integer|gt:0',
        'order_no' => 'max:40',
        'seller_org_id' => 'integer|gt:0',
        'buyer_org_id' => 'integer|gt:0',
        'company_id' => 'integer|gt:0',
        'company_name' => 'max:120',
        'shipment_no' => 'max:80',
        'is_cod' => 'in:0,1',
        'freight_amount' => 'float',
        'freight_currency' => 'max:10',
        'freight_remark' => 'max:255',
        'assist_user_id' => 'integer|gt:0',
        'pickup_address' => 'max:255',
        'weight' => 'float',
        'package_count' => 'integer|gt:0',
        'consignee' => 'max:50',
        'consignee_phone' => 'max:20',
        'consignee_addr' => 'max:255',
        'status' => 'in:0,1,2,3,4,5,6',
    ];

    protected $scene = [
        'create' => [
            'order_id',
            'order_no',
            'seller_org_id',
            'buyer_org_id',
            'company_id',
            'company_name',
            'shipment_no',
            'is_cod',
            'freight_amount',
            'freight_currency',
            'freight_remark',
            'assist_user_id',
            'pickup_address',
            'pickup_time',
            'weight',
            'package_count',
            'consignee',
            'consignee_phone',
            'consignee_addr',
            'status',
        ],
        'update' => [
            'id',
            'order_id',
            'order_no',
            'seller_org_id',
            'buyer_org_id',
            'company_id',
            'company_name',
            'shipment_no',
            'is_cod',
            'freight_amount',
            'freight_currency',
            'freight_remark',
            'assist_user_id',
            'pickup_address',
            'pickup_time',
            'weight',
            'package_count',
            'consignee',
            'consignee_phone',
            'consignee_addr',
            'ship_time',
            'delivery_time',
            'signed_time',
            'status',
            'remark',
        ],
    ];
}
